[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
THE DESPATCHER HOOK
The main purpose of displaying a menu is to allow the user to select a
topic and then see some action! The Toolkit calls a programmer
assigned despatcher every time the user selects a topic (that doesn't
just call another menu).
The despatch procedure is like a user hook. It MUST be defined,
otherwise the menu will have no way of linking into your procedures.
To use a procedure as a despatcher it must:
1) Be a procedure declared with two parameters - a variable integer
that identifies which topic was selected (i.e. the topic selection
code) and a variable byte that is used to inform the menu system which
refresh tasks should be performed when the despatch procedure has
completed. For example
PROCEDURE TASK_CALLER(VAR TOPICCODE:INTEGER; VAR RETCODE: BYTE);
BEGIN
......
END;
2) Be declared as a far procedure, i.e. precede the procedure with a
{$F+} compiler directive and succeed the procedure with the {$F-}
compiler directive.
The technique of assigning the despatcher for Turbo Pascal 5.0 is
different from version 4.0:
Turbo 5 Users - call the procedure Assign_Despatcher and pass the name
of the procedure, e.g.
ASSIGN_DESPATCHER(TASK_CALLER)
Turbo 4 Users - a global variable Nest_Despatcher (of type Pointer)
should point to the procedure with the @ directive, e.g.
NEST_DESPATCHER := @TASK_CALLER
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson